package com.gun.servletComponent;

/**
 * @Authar: 吾图南
 * @Data: 2022/12/10 10:41
 * @Package: com.gun.servletComponent
 * @ClassName: MyServlet
 * @Description: TODO 自定义Servlet类
 */
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
@WebServlet("/annotationServlet")
//@Component  //将MyServlet类作为组件注入Spring容器。
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        this.doPost(req, resp);
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        resp.getWriter().write("hello MyServlet");
    }
}


